home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
kermit.columbia.edu
/
kermit.columbia.edu.tar
/
kermit.columbia.edu
/
newsgroups
/
misc.19950929-19951130
/
000101_news@columbia.edu_Fri Oct 13 19:20:26 1995.msg
< prev
next >
Wrap
Internet Message Format
|
1995-12-25
|
2KB
Received: from apakabar.cc.columbia.edu by watsun.cc.columbia.edu with SMTP id AA21315
(5.65c+CU/IDA-1.4.4/HLK for <kermit.misc@watsun.cc.columbia.edu>); Sat, 14 Oct 1995 07:58:14 -0400
Received: by apakabar.cc.columbia.edu id AA11823
(5.65c+CU/IDA-1.4.4/HLK for kermit.misc@watsun); Sat, 14 Oct 1995 07:58:12 -0400
Newsgroups: comp.protocols.kermit.misc
Path: news.columbia.edu!panix!news.mathworks.com!news.kei.com!simtel!swidir.switch.ch!scsing.switch.ch!news.belwue.de!news.uni-ulm.de!rz.uni-karlsruhe.de!snert!flatlin!bad
From: bad@flatlin.ka.sub.org (Christoph Badura)
Subject: Re: is there any effect of ANDing a byte with 0377 (octal)?
Date: Fri, 13 Oct 1995 19:20:26 GMT
Message-Id: <DGEJ23.1B4@flatlin.ka.sub.org>
References: <45ja2n$mqq@cnj.digex.net>
Followup-To: comp.lang.c
Organization: Guru Systems/Funware Department
Lines: 27
Apparently-To: kermit.misc@watsun.cc.columbia.edu
Why "Distribution: usa?" Do you think we Europeans can't answer that
question?
In <45ja2n$mqq@cnj.digex.net> hashmi@cnj.digex.net (Atiqullah Hashmi) writes:
>In one communcation software I work with, I see that before transmiting
>some chars., they are ANDed with '0377' (octal 377) which is 011 111 111.
>It seems that it will just leave the 8-bit byte as is.
Assuming that your communications software is written in C I can think
of two possible reasons.
1) Assuring that it is indeed an 8 bit character. The C language
doesn't specify the number of bits in a char. (Ansi C provides the
CHAR_BIT (sp?) #defined constant, though.) I believe some machines
had 9 bit characters.
2) KNR C parameter passing. In KNR C there's no way to pass a char
parameter to a function. It gets automatically promoted to int.
Further, chars might be signed or unsigned quantities. If a "signed"
char has the high bit set it is sign-extended when passed to function
or assigned to an int.
--
Christoph Badura bad@flatlin.ka.sub.org +49 721 606137
Es genuegt nicht, keine Gedanken zu haben;
man muss auch unfaehig sein, sie auszudruecken. - Karl Kraus